﻿using System;
using System.Collections.Generic;
using System.Linq;
using Localization;
using SinBiota.Model.Business.PersistenceServices.Interfaces;
using SinBiota.Model.Entities;
using SinBiota.Model.Persistence.Repositories.Interfaces;

namespace SinBiota.Model.Business.PersistenceServices.Implementation
{
    public class PublicationPersistenceServices : IPublicationPersistenceServices
    {
        private readonly IPublicationRepository _publicationRepository;

        public PublicationPersistenceServices(IPublicationRepository publicationRepository)
        {
            _publicationRepository = publicationRepository;
        }

        public Publication FindById(int id)
        {
            return _publicationRepository.FindById(id);
        }

        public IList<Publication> FindAll()
        {
            return _publicationRepository.FindAll();
        }

        public void Delete(Publication publication)
        {
            _publicationRepository.Delete(publication);
        }

        public void DeleteById(int id)
        {
            Delete(FindById(id));
        }
        public void Save(Publication publication)
        {

            _publicationRepository.Save(publication);
        }

        public void Update(Publication publication)
        {
            _publicationRepository.SaveOrUpdate(publication);
        }

    }
}